package sunshine.commcon.util.enums;


import lombok.Getter;

@   Getter
public enum ResultCodeEnum {
    SUCCESS(200, "成功"),
    FAIL(500, "失败"),
    NOT_FOUND(404, "未找到"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_SUPPORTED(415, "不支持"),
    NOT_ACCEPTABLE(406, "不支持"),
    METHOD_NOT_ALLOWED(405, "方法不允许"),
    REQUEST_TIMEOUT(408, "请求超时"),
    CONFLICT(409, "冲突"),
    GONE(410, "已删除");

    public int code;
    public String message;
    ResultCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }


    public static ResultCodeEnum getResultCodeEnum(int code) {
        for (ResultCodeEnum value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }

}
